package com.efast.dmom.equipment.controller.homepage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.dmom.equipment.bean.EquipHomePageBean;
import com.efast.dmom.equipment.bean.EquipHomeTaskParamBean;
import com.efast.dmom.equipment.bean.EquipInterferSpecificDataBean;
import com.efast.dmom.equipment.service.masterdata.EquipReportService;
import com.efast.dmom.equipment.service.masterdata.EquipTaskPageService;
import com.efast.dmom.equipment.service.masterdata.IEquipMasterDataReportService;

/**
 * 
 * zch
 */
@Controller
@RequestMapping("/equipment")
public class EquipHomePageController {

	@Autowired
    private IEquipMasterDataReportService iEquipMasterDataReportService;
	@Autowired
    private EquipReportService equipReportService;
	
	@Autowired
	private EquipTaskPageService  equipTaskPageService;
	
	
	@RequestMapping(value = "/homepage", method = RequestMethod.POST)
	public  @ResponseBody EquipHomePageBean queryEquipHomePage() {
		EquipHomePageBean bean = new EquipHomePageBean();

		bean.setRepairPlan(equipReportService.EquipRepairMonthlyPlan());
		bean.setMaintainPlan(equipReportService.EquipMaintainMonthlyPlan());
		bean.setEquipUseInfo(equipReportService.EquipUseView());
		bean.setPartsUseInfo(iEquipMasterDataReportService.selectPartSum());
		return  bean;
	}
	
	  
	  @RequestMapping(value = "/check/{orderNumber}", method = RequestMethod.POST)
	  public  @ResponseBody EquipInterferSpecificDataBean queryEquipCheckTaskBaseDetail(@PathVariable String orderNumber) {

	     return equipTaskPageService.selectEquipCheckOrderDetail(orderNumber);

	  }
	  
	  
	  
	  @RequestMapping(value = "/maintain/{orderNumber}", method = RequestMethod.POST)
	  public  @ResponseBody EquipInterferSpecificDataBean queryEquipMaintainTaskBaseDetail(@PathVariable String orderNumber) {

	      return equipTaskPageService.selectEquipMaintainOrderDetail(orderNumber);

	  }

	  
	  @RequestMapping(value = "/check/taskBase", method = RequestMethod.POST)
	  public @ResponseBody EquipHomeTaskParamBean queryEquipCheckTaskBase(@RequestBody EquipHomeTaskParamBean bean) {
	     return equipTaskPageService.selectEquipCheckOrder(bean);
	  }

	  
	  @RequestMapping(value = "/maintian/taskBase", method = RequestMethod.POST)
	  public @ResponseBody EquipHomeTaskParamBean queryEquipMaintainTaskBase(@RequestBody EquipHomeTaskParamBean bean) {
		  return equipTaskPageService.selectEquipMaintainOrder(bean);
	  }
}
